package com.neu.controller;

import com.neu.base.Result;
import com.neu.service.InvitationService;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/invitations")
@Tag(name = "邀请管理")
public class InvitationController {

    @Autowired
    private InvitationService invitationService;
    @PostMapping("/details")
    public Result details(@RequestParam String token) {
        return invitationService.getInvitationDetails(token);
    }
    @PostMapping("/accept")
    public Result acceptInvitation(@RequestParam String token) {
        return invitationService.updateInvitationStatus(token,"1");
    }

    @PostMapping("/reject")
    public Result rejectInvitation(@RequestParam String token) {
        return invitationService.updateInvitationStatus(token, "2");
    }
}
